import request from '@/utils/request'

export function getverifycode (mobile) {
  return request({
    url: '/v1_0/sms/codes/' + mobile
  })
}

export function login (data) {
  return request({
    url: '/v1_0/authorizations',
    method: 'post',
    data
  })
}

export function getUserSelfInfo () {
  return request({
    url: '/v1_0/user'
  })
}
// 获取用户频道
export function getUserSelfchannels () {
  return request({
    url: '/v1_0/user/channels'
  })
}
// 获取全部频道
export function getAllchannels () {
  return request({
    url: '/v1_0/channels'
  })
}

// 更新用户频道

export function addchannels (obj) {
  return request({
    url: '/v1_0/user/channels',
    method: 'PATCH',
    data: {
      channels: [obj]
    }
  })
}
// 删除指定频道
export function deltechannels (id) {
  return request({
    url: '/v1_0/user/channels/' + id,
    method: 'DELETE'
  })
}

// 获取用户个人资料
export function edituserinfo () {
  return request({
    url: '/v1_0/user/profile'
  })
}

// 编辑用户资料
export function toedituserinfo (data) {
  return request({
    url: '/v1_0/user/profile',
    method: 'PATCH',
    data
  })
}
// 上传头像
export function getimageupload (data) {
  return request({
    url: '/v1_0/user/photo',
    method: 'PATCH',
    data
  })
}
